<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>



    <h1>兼容 ie </h1>

    <h2> Accordion-menu-4 </h2>

    <h2> 使用的是 : 
        .accordion:after {
            background-image: url();
    </h2>




    <style>
        *{
            margin: 0;padding: 0;
        }
        .accordion {
            background-color: #eee;
            color: #444;
            cursor: pointer;
            width: 100%;
            height: 100px;
            line-height: 100px;
            padding-left: 20px;
            border: none;
            text-align: left;
            outline: none;
            font-size: 36px;
            transition: 0.4s;
        }

        .active,
        .accordion:hover {
            background-color: #ccc;
            font-size: 36px;
        }

        .accordion:after {
            content: '';
            color: #777;
            font-weight: bold;
            float: right;
            position: relative;
            top: 24px;
            right: 36px;
            background-image: url();
            display: inline-block;
            /* background: lightblue; */
            width: 36px;
            height: 36px;
            background-repeat: no-repeat;
            background-size: cover;
            background-position: 50%;
            -webkit-transform: rotate(180deg) translateZ(0);
            transform: rotate(180deg) translateZ(0);
            -webkit-transition: all .3s ease-out;
            transition: all .3s ease-out;


        }

        .active:after {
            transform: rotate(0deg) translateZ(0);
        }

        .panel {
            padding: 0 18px;
            background-color: white;
            font-size: 36px;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.2s ease-out;
        }
    </style>
    <p class="accordion" onclick="toggle_this(this)">Section 1</p>
    <div class="panel">
        <p>Lorem ipsum dolor sit amet, consectetur  veniam, quis .</p>
    </div>


    <p class="accordion" onclick="toggle_this(this)">Section 1</p>
    <div class="panel">
        <p>Lorem ipsum dolor sit amet, consectetur . Ut .</p>
    </div>


    <p class="accordion" onclick="toggle_this(this)">Section 1</p>
    <div class="panel">
        <p>Lorem ipsum dolor sit amet, consectetur . .</p>
    </div>



    <script>

        function toggle_this(eee) {
            var accordionsss = document.querySelectorAll(".accordion");
            // 循环绑定点击事件: 
            for (let i = 0; i < accordionsss.length; i++) {
                if (accordionsss[i] == eee) {
                    eee.classList.toggle('active');
                    //  下个元素,  获取内容区的高度
                    let panel = eee.nextElementSibling;
                    console.log("现在的容器的高度是:     " + panel.style.maxHeight);

                    // 如果内容区的高度为真,  不为空, 说明这个内容区被撑开:
                    if (panel.style.maxHeight) {
                        console.log("现在的容器的高度是:     " + panel.style.maxHeight);   // 如果容器有高度值, 那么就把它变成 null
                        panel.style.maxHeight = null;
                        console.log("  maxHeight = null,  现在的容器的高度是:     " + panel.style.maxHeight);
                    } else {
                        console.log("现在的容器的高度是 nulllll   ");
                        panel.style.maxHeight = panel.scrollHeight + "px";      // 如果容器没有高度值, 那么就把它变成 容器的高度
                        console.log("   panel.scrollHeight + ,  现在的容器的高度是:     " + panel.style.maxHeight);
                    }
                } else {
                    accordionsss[i].nextElementSibling.style.maxHeight = null;
                    accordionsss[i].classList.remove('active');
                }
            }
        }
    </script>




</body>

</html>